package org.jet.emall.rbac.service;

import org.jet.emall.rbac.dto.AdminPrivilegeDTO;
import org.jet.emall.rbac.po.AdminPrivilegeView;
import org.jet.emall.rbac.service.mp.IAdminPrivilegeViewService;
import org.jet.emall.rbac.service.tool.TreeTool;
import org.jet.emall.rbac.transfer.AdminPrivilegeDtoTransfer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.*;

/**
 * @author xiaozai
 * @version 1.0
 * @date 2020-04-10 13:40
 */
@Service
public class CustomAdminPrivilegeServiceImpl implements CustomAdminPrivilegeService {

    @Autowired
    IAdminPrivilegeViewService adminPrivilegeViewService;

    @Override
    public List<AdminPrivilegeDTO> list() {
        List<AdminPrivilegeView> list = adminPrivilegeViewService.list();
        return TreeTool.makeTree(AdminPrivilegeDtoTransfer.INSTANCE.toDtoList(list));
    }
}
